/*     */ package com.bdf.ipharma.model;
/*     */ 
/*     */ import java.io.Serializable;
/*     */ 
/*     */ public class BusinessObject
/*     */   implements Serializable, Comparable
/*     */ {
/*     */   private Long id;
/*     */   private String descripcion;
/*     */ 
/*     */   public Long getId()
/*     */   {
/*  35 */     return this.id;
/*     */   }
/*     */ 
/*     */   public void setId(Long id)
/*     */   {
/*  42 */     this.id = id;
/*     */   }
/*     */ 
/*     */   public String getDescripcion()
/*     */   {
/*  51 */     return this.descripcion;
/*     */   }
/*     */ 
/*     */   public void setDescripcion(String descripcion) {
/*  55 */     this.descripcion = descripcion;
/*     */   }
/*     */ 
/*     */   public boolean equals(Object unObjeto)
/*     */   {
/*  79 */     if (null == getId()) {
/*  80 */       return super.equals(unObjeto);
/*     */     }
/*     */ 
/*  83 */     boolean isInstanceOf = getClass().isInstance(unObjeto);
/*     */ 
/*  86 */     if (isInstanceOf)
/*     */     {
/*  88 */       BusinessObject bo = (BusinessObject)unObjeto;
/*     */ 
/*  90 */       if (null == bo.getId()) {
/*  91 */         return super.equals(unObjeto);
/*     */       }
/*     */ 
/*  94 */       return getId().equals(bo.getId());
/*     */     }
/*     */ 
/*  97 */     return false;
/*     */   }
/*     */ 
/*     */   public int hashCode()
/*     */   {
/* 107 */     if (null == getId()) {
/* 108 */       return super.hashCode();
/*     */     }
/* 110 */     return getId().hashCode();
/*     */   }
/*     */ 
/*     */   public int compareTo(Object o)
/*     */   {
/* 123 */     if (!(o instanceof BusinessObject)) {
/* 124 */       throw new IllegalArgumentException(o + " no es comparable con " + this);
/*     */     }
/*     */ 
/* 127 */     BusinessObject bo = (BusinessObject)o;
/*     */ 
/* 129 */     if ((null == getId()) && (null == bo.getId())) {
/* 130 */       throw new IllegalStateException(o + " no es comparable con " + this);
/*     */     }
/*     */ 
/* 134 */     if ((null == getId()) && (null != bo.getId())) {
/* 135 */       return 1;
/*     */     }
/*     */ 
/* 138 */     if ((null != getId()) && (null == bo.getId())) {
/* 139 */       return -1;
/*     */     }
/*     */ 
/* 142 */     return getId().compareTo(bo.getId());
/*     */   }
/*     */ }

/* Location:           D:\programacion\bdf\SWING\lib (1)\ipharmaClient.jar
 * Qualified Name:     com.ipharma.model.BusinessObject
 * JD-Core Version:    0.6.0
 */